/*
 ============================================================================
 Name		: SimpleTimer.h
 Author	  : Den Grigorenko
 Copyright   : Copyright (c) 2008 Den123
 Description : Simple timer with the help of the active object
 ============================================================================
*/

#ifndef __SIMPLETIMER_H__
#define __SIMPLETIMER_H__

#include <e32base.h>


class MSimpleTimerNotify
{
   public:
      virtual void TimerExpired( TAny* aTimer,TInt aError ) = 0;
};
 
class CSimpleTimer: public CActive
{
   public:
      static CSimpleTimer* NewL(const TInt aPriority, MSimpleTimerNotify& aNotify);
      ~CSimpleTimer();
      void After(TTimeIntervalMicroSeconds32 aInterval);
		
   protected:
      void RunL();
      void DoCancel();
		
   private:
      CSimpleTimer(const TInt aPriority,MSimpleTimerNotify& aNotify);
      void ConstructL(void);
		
   private:
      RTimer iTimer;
      MSimpleTimerNotify&	iNotify;
};


#endif

